<template>
  <div class="orderDetails publicBox">
    <div class="publicBoxTitle ">
      异常信息
    </div>
    <div class="allOrderBox publicBoxContent">
      <div class="nav">
<!--        <div class="navTitle">异常编码：202246246565854141</div>-->
        <div class="navTitle">异常时间：{{orderDetails && orderDetails.create_at}}</div>
<!--        <div class="navTitle">异常类型：身份验证失败</div>-->
        <div class="navTitle">异常状态：{{orderDetails && orderDetails.order_error.split("：")[1]}}</div>
      </div>

    </div>
    <div class="publicBoxTitle ">
      订单明细
    </div>
    <div class="orderDetailed publicBoxContent" v-if="orderDetails">
      <div class="detailTitle">
                <span>订单编号：{{orderDetails.child_no}}
<!--                  <span class="detailLeft">状态：异常</span>-->
<!--                    <span class="detailLeft">下单账号：5464654654654</span>-->
                </span>
      </div>
      <div class="detailTitle">
        <span>收货地址： {{orderDetails.address.detail}}</span>
      </div>
      <div class="detailTitle">
        <span>报关信息：{{orderDetails.address.name}} {{orderDetails.address.phone}} {{orderDetails.address.id_card_number}}</span>
      </div>
      <div class="detailTitle">
          <span>交易单号：{{orderDetails.order_m.order_no}}
            <!--            <span class="detailLeft">交易流水号：7464654654654</span>-->
          </span>
      </div>
      <div class="info_sp" v-for="(item,index) in orderDetails.goods" :key="index">
        <div class="info_top">
          <table>
            <tr>
              <td class="tableLeft">商品</td>
              <td class="guding">贸易方式</td>
              <td class="guding" v-for="(ite,inde) in item.attr">{{ite[0]}}</td>
              <td class="guding">商品金额(元)</td>
            </tr>
          </table>
        </div>
        <div class="info_centent">
          <table>
            <tr>
              <td class="tableLeft ">
                <div class="cnm">
                  <div class="tableLeftImg">
                    <img :src="$getImg(item.image)" alt="">
                  </div>
                  <div class="tableLeftName">
                    <p>{{item.goods_name}}</p>
                  </div>
                </div>
              </td>
              <td class="guding">{{item.trade_type_name}}</td>
              <td class="guding" v-for="(ite,inde) in item.attr">
                {{ite[1]}}
                <span v-show="ite[0]=='数量'">{{item.unit}}</span>
              </td>
              <td class="guding">{{item.goods_price}}</td>
            </tr>
            <tr>
              <td :colspan="num">
                <div class="info_bottom">
                  <div>
                    <span>留言：{{item.buyer_remark}}</span>
                  </div>
                  <div class='bottom_rig'>
                    <span>实付金额 </span>
                    <span class="total">¥{{item.goods_price}}</span>
                  </div>
                </div>
              </td>
            </tr>
          </table>

        </div>
      </div>
      <div class="bottom">
        <div>
            <span>(运费：{{orderDetails.shipping_amount}}) </span>
            <span>总金额：{{orderDetails.total_price}}</span>
        </div>
<!--          <div>-->
<!--              <el-button type="primary" plain>申请退款</el-button>-->
<!--          </div>-->

      </div>
    </div>
  </div>
</template>

<script>
    export default {
        name: "orderDetails",
        data() {
            return {
                orderId: '',
                orderDetails: null,
                num: 5,
            };
        },
        created() {
            this.orderId = this.$route.query.orderId;
            this.getDetail()

        },
        methods: {
            getDetail() {

                this.$HttpGet("/index.php?s=/admin/order/detail", {
                    order_child_id: this.orderId
                }).then(res => {

                    this.orderDetails = res.data;
                    // this.orderDetails.goods[1]= this.orderDetails.goods[0]

                    //拆分规格
                    for (let i = 0; i < this.orderDetails.goods.length; i++) {
                        var arr = this.orderDetails.goods[i].goods_attr.split("|");
                        var endArr = arr.map((item, index) => {
                            return item.split("_")
                        });
                        endArr.pop();
                        this.num += endArr.length;
                        this.orderDetails.goods[i].attr = endArr;
                    }
                    console.log(this.orderDetails)
                })
            },
        }
    }
</script>

<style scoped lang="scss">
  .dip {
    height: auto !important;
  }

  .sho {
    height: 200px !important;
  }

  .orderDetails {
    .publicBoxTitle {
      position: relative;
      padding-left: 10px;

      &:before {
        content: '';
        width: 4px;
        height: 14px;
        background: #3A61CA;
        position: absolute;
        left: 1px;
        top: 3px;
      }
    }

    .allOrderBox {

      .nav {
        position: relative;
        width: 1020px;
        height: 100%;
        padding-top: 20px;

        .navTitle {
          margin-bottom: 20px;
        }
      }

    }

    .logistics {
      height: 30px;

      .logisticsTitle {
        height: 30px;
        line-height: 30px;

        > span {
          margin-right: 75px;
          color: rgba(0, 0, 0, 0.5);

          span {
            color: black;
          }
        }
      }

      .logisticsStatus {
        height: 200px;
        overflow: hidden;
        display: block;
        padding-left: 1px;
      }

      .logisticsBtn {
        font-size: 12px;
        font-weight: 400;
        margin-top: 10px;
        color: #3A61CA;
      }

    }

    .orderDetailed {
      padding-top: 10px;

      .detailTitle {
        margin-top: 20px;

        .detailLeft {
          margin-left: 30px;
        }
      }

      .info_sp {
        width: 100%;
        margin-top: 20px;

        .info_top {
          width: 100%;
          height: 40px;
          background: rgba($color: #385cc8, $alpha: 0.1);
          padding-left: 15px;
          display: flex;
          justify-content: space-around;
          text-align: left;
          box-sizing: border-box;

          table {
            width: 100%;
            height: 100%;

            .tableLeft {
              width: 30%;
            }
          }
        }

        .info_centent {
          padding-left: 15px;
          width: calc(100% - 2px);

          background: #ffffff;
          border-left: 1px solid #eeeeee;
          border-right: 1px solid #eeeeee;
          box-sizing: border-box;

          table {
            width: 100%;
            height: 100%;

            .tableLeft {
              width: 30%;
              height: 100%;

              .cnm {
                width: 100%;
                height: 100%;
                display: flex;
                align-items: center;

                .tableLeftImg {
                  img {
                    width: 56px;
                    height: 56px;
                  }
                }

                .tableLeftName {
                  margin-left: 16px;

                  p {
                    display: -webkit-box;
                    -webkit-box-orient: vertical;
                    -webkit-line-clamp: 2;
                    overflow: hidden;
                    margin-top: 10px;
                    margin-bottom: 10px;
                  }
                }
              }

            }

            tr {
              td {
                .info_bottom {
                  width: calc(100% + 6px);
                  height: 50px;
                  padding-left: 15px;
                  margin-left: -18px;
                  // line-height: 50px;
                  background: rgba($color: #385cc8, $alpha: 0.05);
                  display: flex;
                  justify-content: space-between;
                  align-content: center;
                  align-items: center;

                  input {
                    width: 550px;
                    height: 30px;
                    background: #ffffff;
                    border: 1px solid #eeeeee;
                    border-radius: 5px;
                  }

                  .bottom_rig {
                    text-align: right;
                    padding-right: 20px;
                    box-sizing: border-box;

                    .total {
                      margin-left: 35px;
                      margin-right: 20px;
                      color: rgba(#E93030, 0.7);

                    }
                  }
                }
              }
            }
          }

        }


      }

      .bottom {
        margin-top: 20px;
        width: 100%;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        align-items: flex-end;
        background: rgba(56, 92, 200, 0.05);
        padding-right: 40px;
        box-sizing: border-box;

        div {
          &:first-child {
            margin-top: 10px;
          }
            span{
                margin-left: 20px;
            }
          margin-bottom: 10px;
        }

      }
    }
      .guding {
          width: 10%;

          .statusBtn {
              display: block;
              margin-bottom: 5px;
              color: #409EFF;
              cursor: pointer;
              width: 64px;
              height: 24px;
              text-align: center;
              line-height: 24px;
              border-radius: 6px;
          }

          .cancal {
              background: #FFFFFF;
              border: 1px solid #EEEEEE;
              color: #333333;
          }

          .cancal:hover {
              background: #EEEEEE;
              border: 1px solid #D2D2D2;
          }

          .immediatePayment {
              color: #E93030;
              background: #FFFFFF;
              border: 1px solid #E93030;
          }

          .immediatePayment:hover {
              background: #E93030;
              color: #FFFFFF;
          }
      }

  }
</style>